package com.example.lanouhn.bantangapp.activities.activities;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.lanouhn.bantangapp.R;
import com.example.lanouhn.bantangapp.activities.contants.LoginNP;
import com.example.lanouhn.bantangapp.activities.contants.Search_hottag_url;
import com.example.lanouhn.bantangapp.activities.utils.HttpUtils;
import com.example.lanouhn.bantangapp.activities.utils.JsonUtils_LoginNP;
import com.example.lanouhn.bantangapp.activities.utils.SPUtils;

import java.util.ArrayList;

/**
 * Created by lanouhn on 16/8/4.
 * 接口不全，验证码无法获取
 * 本类暂停
 *
 */
public class ActivityResgin extends Activity {
    private ImageView back;
    private EditText  et_name;//账户输入框
    private EditText  et_pwd;//密码输入框
    private TextView  resgin;//注册

    private EditText keyNumber;//验证码

    private String key;//标识
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.msg_land_signin_register_activity);
        initview();
        initLintener();
    }

    //找到控件
    private void initview() {
        back= (ImageView) findViewById(R.id.back);
        et_name= (EditText) findViewById(R.id.et_name);
        et_pwd= (EditText) findViewById(R.id.et_pwd);
        resgin= (TextView) findViewById(R.id.resgin);
        keyNumber= (EditText) findViewById(R.id.keyNumber);
    }
    //点击监听事件
    private void initLintener() {
        //返回
        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });

        //注册
        resgin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (et_pwd.getText().toString().trim().length()>0
                        &&et_name.getText().toString().trim().length()>0
                        &&keyNumber.getText().toString().trim().length()>0){
                    //判断输入内容是否正确


                }else {
                    Toast.makeText(ActivityResgin.this, "输入内容不能为空！", Toast.LENGTH_SHORT).show();
                }
            }
        });

    }

    //post解析数据
//    private void initDataToPost() {
//
//        list = new ArrayList<>();
//        new Thread(new Runnable() {
//            @Override
//            public void run() {
//                String userName=et_name.getText().toString();
//                String userPwd = et_pwd.getText().toString();
//
//                String url = Search_hottag_url.togURL;//获取网络地址
//                String params="app_id=com.jzyd.BanTang&client_id=bt_app_android&client_secret=ffcda7a1c4ff338e05c42e7972ba7b8d&track_user_id=&oauth_token=&track_deviceid=868596020655823&track_device_info=m2+note&channel_name=UMENG_CHANNEL&app_installtime=1468811189&app_versions=5.8.4&os_versions=5.1&screensize=1080&v=16&username="+userName+"&password="+userPwd+"&grant_type=password&account_auth=d4992bd0839319e73b5fd50f98e7f584";
//                String result = HttpUtils.doPost(url,params);
//
//                if (null!=result&&result.length()>0){
//                    list = JsonUtils_LoginNP.getlloginList(result);
//                    handler.sendEmptyMessage(1);
//                }else{
//                    handler.sendEmptyMessage(0);
//                }
//
//            }
//
//
//        }).start();
//    }
//
//
//    private Handler handler = new Handler() {
//        @Override
//        public void handleMessage(Message msg) {
//            super.handleMessage(msg);
//            switch (msg.what) {
//                case 1:
//                    LoginNP l = new LoginNP();
//                    key=l.getAccess_token();
//
//
//                    break;
//                case 0:
//                    Toast.makeText(ActivityLogin.this,"系统繁忙，请稍后再试！",Toast.LENGTH_SHORT).show();
//                    break;
//
//            }
//        }
//    };

}

